<?php
/**
 * @version $Id: admin.easycomments.html.php 298 2007-12-03 21:10:12Z elkuku $
 * @package EasyComments
 * EasyComments - A Joomla Comment Component
 * Based on akocomment
 * @license Released under the terms of the GNU General Public License (see LICENSE.php in the Joomla! root directory)
 * @Achim Raji (aka cybergurk) - David Jardin (aka SniperSister) - Cedric May - Siegmund Langsch (aka langsch2)
 **/

( defined( '_JEXEC' ) ) or ( defined( '_VALID_MOS' ) ) or die( 'Restricted access' );
class HTML_comment {
function showConfig($dbsectionlist, $seclistarray, $dbuserslist, $userslistarray, $usertypes, $grouplistarray, $ec_config, $option, $version) {
	global $mosConfig_live_site;
	?>

<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform( pressbutton );
			return;
		}
		submitform( pressbutton );
	}
	function sections(){
		if(document.adminForm.ec_mainmode[2].checked == true) {
			document.getElementById('sections').style.display='block';
		} else {
			document.getElementById('sections').style.display='none';
		}
	}
	function email(){
		if(document.adminForm.ec_notify[1].checked == true) {
			document.getElementById('email').style.display='block';
		} else {
			document.getElementById('email').style.display='none';
		}
	}
	function frontend_edit(){
		if(document.adminForm.frontendedit[0].checked == true) {
			document.getElementById('ec_fe_allow_groups').style.display='none';
			document.getElementById('ec_fe_allow_users').style.display='none';
		} else if(document.adminForm.frontendedit[1].checked == true) {
			document.getElementById('ec_fe_allow_groups').style.display='block';
			document.getElementById('ec_fe_allow_users').style.display='none';
		} else if(document.adminForm.frontendedit[2].checked == true) {
			document.getElementById('ec_fe_allow_groups').style.display='none';
			document.getElementById('ec_fe_allow_users').style.display='block';
		} else if(document.adminForm.frontendedit[3].checked == true) {
			document.getElementById('ec_fe_allow_groups').style.display='block';
			document.getElementById('ec_fe_allow_users').style.display='block';
		} else {
			document.getElementById('ec_fe_allow_groups').style.display='none';
			document.getElementById('ec_fe_allow_users').style.display='none';
		}
	}
</script>
<div style='background-image: url(components/com_easycomments/images/admin.settings_top.jpg); width: 899px; height: 54px; color: #7e8a91; font-size: 21px; text-align: left; margin-top: 10px;'>
	<div style="padding-left: 25px;  padding-top: 10px;">
		<?php echo _EASYCOMMENTS_ADMIN_GENERAL_SETTINGS; ?>
	</div>
</div>
<div style='background-image: url(components/com_easycomments/images/admin.settings_bg.jpg); width: 899px; color: #4c4e4f; font-size: 11px; text-align: left;'>
<div style="margin-left: 40px; margin-right: 40px;">
	<form action="index2.php" method="POST" name="adminForm">

		<div style='float: left; clear: right; width: 300px;'>
			<?php
			HTML_comment::_cfg_nofooter( $ec_config );
			HTML_comment::_cfg_mainmode( $ec_config, $dbsectionlist, $seclistarray );
			?>
		</div>

		<div style='clear: right; float: left;'>
			<?php
			HTML_comment::_cfg_autopublish( $ec_config );
			HTML_comment::_cfg_anonentry( $ec_config );
			HTML_comment::_cfg_maxlengths( $ec_config );
			HTML_comment::_cfg_captcha( $ec_config );
			HTML_comment::_cfg_notify( $ec_config );
			HTML_comment::_cfg_versioncheck( $ec_config );
			?>
		</div>

		<div style='float: right; width: 210px;'>
			<?php
			HTML_comment::_cfg_sorting( $ec_config );
			HTML_comment::_cfg_formposition( $ec_config );
			HTML_comment::_cfg_readmore( $ec_config );
			HTML_comment::_cfg_emailcloaking( $ec_config );
			HTML_comment::_cfg_frontendediting( $ec_config, $dbuserslist, $userslistarray, $usertypes, $grouplistarray );
			?>
		</div>

		<div style='clear: both;'>
		</div>
		<div style="float: right; margin-top: 5px;">
			<a href="javascript:submitbutton('savesettings');">
				<span style="background-image: url(<?php echo $mosConfig_live_site; ?>/administrator/components/com_easycomments/images/admin.button.jpg); height: 29px; width: 89px; line-height: 29px; font-weight: bold; display: block; text-align: center; color: #ffffff;"><?php echo _EASYCOMMENTS_ADMIN_SAVE_SETTINGS; ?></span>
			</a>
		</div>
		<input type="hidden" name="ec_config['version']" value="<?php echo $ec_config['version']; ?>">
		<input type="hidden" name="option" value="<?php echo $option; ?>">
<!--		<input type="hidden" name="act" value="<?php //echo $act; ?>"> not found...still required? -->
		<input type="hidden" name="task" value="">
		<input type="hidden" name="boxchecked" value="0">
	</form>
</div>
</div>

<style type='text/css'>
	<!--
		.version a {color: #777777; text-decoration: none;}
		.version a:hover {color: #595959; text-decoration: none;}
	-->
</style>

<div class='version' style='background-image: url(components/com_easycomments/images/admin.settings_bottom.jpg); background-position: bottom; width: 899px; height: 36px; font-size: 11px; color: #777777; padding-top: 40px; padding-bottom: 20px;'>
<?php echo $version; ?>
</div>
<?php
}

/**
 * Config Helper functions
 */
function _cfg_nofooter( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_NOFOOTER; ?></strong>
			<br/>
			<input type="radio" name="ec_config['nofooter']" id="ec_nofooter0" value="0" <?php if ($ec_config['nofooter'] != "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_nofooter0"><?php echo _EASYCOMMENTS_ADMIN_NOFOOTER_A; ?></label>
			<br/>
			<input type="radio" name="ec_config['nofooter']" id="ec_nofooter1" value="1" <?php if ($ec_config['nofooter'] == "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_nofooter1"><?php echo _EASYCOMMENTS_ADMIN_NOFOOTER_B; ?></label>
			<br/>
			<br/>
	<?php
} // function

function _cfg_maxlengths( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_MAXLENGTHS; ?></strong>
			<br/>
			<label for="maxlng_comment"><?php echo _EASYCOMMENTS_ADMIN_MAXLENGTH_COMMENT; ?></label>
			<input type="text" name="ec_config['maxlng_comment']" id="maxlng_comment" size="3" maxlength="3" value="<?php echo $ec_config['maxlng_comment']; ?>" />
			<?php echo _EASYCOMMENTS_CHARS; ?>
			<br/>
			<label for="maxlng_word"><?php echo _EASYCOMMENTS_ADMIN_MAXLENGTH_WORD; ?></label>
			<input type="text" name="ec_config['maxlng_word']" id="maxlng_word" size="3" maxlength="3" value="<?php echo $ec_config['maxlng_word']; ?>" />
			<?php echo _EASYCOMMENTS_CHARS; ?>
			<br/>
			<br/>
	<?php
} // function

/**
 * modes:
 * 0-all
 * 1-only on {}
 * 2-only on selected sections
 */
function _cfg_mainmode( $ec_config, $dbsectionlist, $seclistarray )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_MAINMODE; ?></strong>
			<br />
			<input type="radio" name="ec_mainmode" id="ec_mainmode0" value="0" onchange="sections()" <?php if ($ec_config['mainmode'] == '0') {echo "checked='checked'";} ?> />
			<label for="ec_mainmode0"><?php echo _EASYCOMMENTS_ADMIN_MAINMODE_A; ?></label>
			<br />
			<input type="radio" name="ec_mainmode" id="ec_mainmode1" value="1" onchange="sections()" <?php if ($ec_config['mainmode'] == '1') {echo "checked='checked'";} ?> />
			<label for="ec_mainmode1"><?php echo _EASYCOMMENTS_ADMIN_MAINMODE_B; ?></label>
			<br />
			<input type="radio" name="ec_mainmode" id="ec_mainmode2" value="2" onchange="sections()" <?php if ($ec_config['mainmode'] == '2') {echo "checked='checked'";} ?> />
			<label for="ec_mainmode2"><?php echo _EASYCOMMENTS_ADMIN_MAINMODE_C; ?></label>
			<br />
			<br />
			<div id="sections" <?php if ($ec_config['mainmode'] != "2") {echo "style='display: none;'";} ?> >
				<b><?php echo _EASYCOMMENTS_ADMIN_SECTIONLIST; ?></b>
				<br />
				<?php foreach ($dbsectionlist as $slrow) { ?>
					<input type='checkbox' name="ec_selections[]" value="<?php echo $slrow->id;?>" <?php if (in_array ($slrow->id, $seclistarray)) {echo "checked='checked'";} ?>>
					<?php echo "$slrow->title"; ?>
					</input>
					<br />
				<?php } ?>
				<br />
			</div>
	<?php
} // function

function _cfg_autopublish( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_AUTOPUBLISH; ?></strong>
			<br/>
			<input type="radio" name="ec_config['autopublish']" id="ec_autopublish0" value="0" <?php if ($ec_config['autopublish'] != "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_autopublish0"><?php echo _EASYCOMMENTS_ADMIN_AUTOPUBLISH_A; ?></label>
			<br/>
			<input type="radio" name="ec_config['autopublish']" id="ec_autopublish1" value="1" <?php if ($ec_config['autopublish'] == "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_autopublish1"><?php echo _EASYCOMMENTS_ADMIN_AUTOPUBLISH_B; ?></label>
			<br/>
			<br/>
	<?php
} // function

function _cfg_anonentry( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_ANONENTRY; ?></strong>
			<br/>
			<input type="radio" name="ec_config['anonentry']" id="ec_anonentry0" value="0" <?php if ($ec_config['anonentry'] != "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_anonentry0"><?php echo _EASYCOMMENTS_ADMIN_ANONENTRY_A; ?></label>
			<br/>
			<input type="radio" name="ec_config['anonentry']" id="ec_anonentry1" value="1" <?php if ($ec_config['anonentry'] == "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_anonentry1"><?php echo _EASYCOMMENTS_ADMIN_ANONENTRY_B; ?></label>
			<br/>
			<br/>
	<?php
} // function

function _cfg_notify( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_NOTIFY; ?></strong>
			<br/>
			<input type="radio" name="ec_notify" id="ec_notify0" value="0" <?php if ($ec_config['notify'] != "1") {echo "checked='checked'";} ?> class="inputbox" onclick="email()"  />
			<label for="ec_notify0"><?php echo _EASYCOMMENTS_ADMIN_NOTIFY_A; ?></label>
			<br/>
			<input type="radio" name="ec_notify" id="ec_notify1" value="1" <?php if ($ec_config['notify'] == "1") {echo "checked='checked'";} ?> class="inputbox" onclick="email()" />
			<label for="ec_notify1"><?php echo _EASYCOMMENTS_ADMIN_NOTIFY_B; ?></label>
			<br/>
			<br/>
			<div id="email" <?php if ($ec_config['notify'] != "1") {echo "style='display: none;'";} ?>>
				<strong><?php echo _EASYCOMMENTS_ADMIN_NOTIFY_EMAIL; ?></strong>
				<br/>
				<input style="width: 200px; border: #ffffff solid 1px; border-left: #4c4e4f solid 3px;  background: #ffffff; margin: 5px; color: #4c4e4f; font-size: 11px; padding: 3px; padding-left: 10px;" type="text" name="ec_config['notify_email']" value="<?php echo $ec_config['notify_email']; ?>">
			</div>
	<?php
} // function
function _cfg_sorting( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_SORTING; ?></strong>
			<br/>
			<input type="radio" name="ec_config['sorting']" id="ec_sorting0" value="DESC" <?php if ($ec_config['sorting'] != "ASC") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_sorting0"><?php echo _EASYCOMMENTS_ADMIN_SORTING_A; ?></label>
			<br/>
			<input type="radio" name="ec_config['sorting']" id="ec_sorting1" value="ASC" <?php if ($ec_config['sorting'] == "ASC") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_sorting1"><?php echo _EASYCOMMENTS_ADMIN_SORTING_B; ?></label>
			<br/>
			<br/>
	<?php
} // function
function _cfg_formposition( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_FORMPOSTITION; ?></strong>
			<br/>
			<input type="radio" name="ec_config['formposition']" id="ec_formposition0" value="0" <?php if ($ec_config['formposition'] != "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_formposition0"><?php echo _EASYCOMMENTS_ADMIN_FORMPOSTITION_A; ?></label>
			<br/>
			<input type="radio" name="ec_config['formposition']" id="ec_formposition1" value="1" <?php if ($ec_config['formposition'] == "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_formposition1"><?php echo _EASYCOMMENTS_ADMIN_FORMPOSTITION_B; ?></label>
			<br/>
			<br/>
	<?php
} // function
function _cfg_frontendediting( $ec_config, $dbuserslist, $userslistarray, $usertypes, $grouplistarray )
{
			
			$display_groups = FALSE;
			$display_users = FALSE;
			switch( $ec_config['frontendedit'] )
			{
				case '0'://disallow
				break;
				case '1'://groups
					$display_groups = TRUE;
				break;
				case '2'://users
					$display_users = TRUE;
				break;
				case '3'://groups + users
					$display_groups = TRUE;
					$display_users = TRUE;
				break;
			}// switch
			
			?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_FRONTENDEDITING; ?></strong>
			<br/>
			<?php //echo $ec_config['frontendedit'].'<br />'; ?>
			<input type="radio" name="frontendedit" id="ec_fe_allow_0" value="0"
				<?php if ($ec_config['frontendedit'] == '0') {echo "checked='checked'";} ?>
				 class="inputbox" onclick="frontend_edit()"  />
			<label for="ec_fe_allow_0"><?php echo _EASYCOMMENTS_ADMIN_FRONTENDEDITING_A; ?></label>
			<br/>
			<input type="radio" name="frontendedit" id="ec_fe_allow_1" value="1"
				<?php if ($ec_config['frontendedit'] == "1") {echo "checked='checked'";} ?>
				 class="inputbox" onclick="frontend_edit()" />
			<label for="ec_fe_allow_1"><?php echo _EASYCOMMENTS_ADMIN_FRONTENDEDITING_B; ?></label>
			<br/>
			<input type="radio" name="frontendedit" id="ec_fe_allow_2" value="2"
				<?php if ($ec_config['frontendedit'] == '2') {echo " checked='checked'";} ?>
				class="inputbox" onclick="frontend_edit()" />
			<label for="ec_fe_allow_2"><?php echo _EASYCOMMENTS_ADMIN_FRONTENDEDITING_C; ?></label>
			<br/>
			<input type="radio" name="frontendedit" id="ec_fe_allow_3" value="3"
				<?php if ($ec_config['frontendedit'] == '3') {echo " checked='checked'";} ?>
				class="inputbox" onclick="frontend_edit()" />
			<label for="ec_fe_allow_3"><?php echo _EASYCOMMENTS_ADMIN_FRONTENDEDITING_D; ?></label>

			<div id="ec_fe_allow_groups" <?php echo ( $display_groups ) ? '' :  " style='display: none;'"; ?> >
				<hr/>
					<strong><?php echo _EASYCOMMENTS_ADMIN_FRONTENDEDITING_GROUPS; ?></strong>
				<hr/>

			<?php
			 
				$cnt = 0;
				foreach( $usertypes as $type )
				{
					 $value = ' value="'.$type->name.'"';
					 $checked = (in_array ($type->name, $grouplistarray)) ? ' checked="checked"' : '';
					 $id = ' id="chk_u_'.$cnt.'"';
				 ?>
				<input type="checkbox" name="ec_sel_groups[]" <?php echo $value.$checked.$id; ?> >
					<label for="chk_u_<?php echo $cnt;?>"><?php echo $type->name; ?></label>
				</input>
				<br />
				<?php 
					$cnt++;
				}
			?>
			</div>
			
			<div id="ec_fe_allow_users" <?php echo ( $display_users ) ? '' :  " style='display: none;'"; ?> >
				<hr/>
					<strong><?php echo _EASYCOMMENTS_ADMIN_FRONTENDEDITING_USERS; ?></strong>
				<br/>
				<?php
			#	$usertypes = array('Super Administrator', 'Administrator', 'Manager', 'Publisher', 'Editor', 'Author','Registered');
				### TODO : optimieren ;)
				$cnt = 0;
				foreach( $usertypes as $type )
				{
					
					$tmp_users = array();
					foreach ($dbuserslist as $ulrow)
					{
						if( $ulrow->usertype == $type->name)
						{
						 	$tmp_users[] = $ulrow;
						}
					}// foreach
					if( count( $tmp_users ) )
					{
						echo '<hr />'.$type->name.'<br />';
						foreach( $tmp_users as $u )
						{
							 $value = ' value="'.$u->id.'"';
							 $checked = (in_array ($u->id, $userslistarray)) ? ' checked="checked"' : '';
							 $id = ' id="chk_g_'.$cnt.'"';
							 ?>
							<input type='checkbox' name="ec_sel_users[]" <?php echo $value . $checked. $id; ?> >
							<label for="chk_g_<?php echo $cnt;?>">
								<?php echo $u->name.' ('.$u->username.' )'; ?>
							</label>
							</input>
							<br />
						<?php 
							$cnt++;
						}// foreach
					}
					 // TODO :: hier muss noch sehr optimiert werden.. query?
				}// foreach
				?>
			</div>
			<br/>
			<br/>
	
	<?php
} // function

function _cfg_readmore ( $ec_config )
{	
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_SHOW_READMORE_DESC; ?></strong>
			<br/>
			<input type="checkbox" name="ec_config['show_readmore']"  <?php if($ec_config['show_readmore']) { echo ' checked="checked" ';} ?> >
				<?php echo _EASYCOMMENTS_ADMIN_SHOW_READMORE; ?>
			</input>
			<br />
			<br />
	<?php
	
} // function
function _cfg_emailcloaking ( $ec_config )
{
		?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_EMAILCLOAKING; ?></strong>
			<br/>
			<select name="emailcloak">
			<?php $selected =( $ec_config['emailcloak'] == '0' ) ? ' selected="selected"' : ''; ?>
				<option value="0"<?php echo $selected.'>'._EASYCOMMENTS_ADMIN_EMAILCLOAKING_A; ?></option>
			<?php $selected =( $ec_config['emailcloak'] == '1' ) ? ' selected="selected"' : ''; ?>
				<option value="1"<?php echo $selected.'>'._EASYCOMMENTS_ADMIN_EMAILCLOAKING_B; ?></option>
			<?php $selected =( $ec_config['emailcloak'] == '2' ) ? ' selected="selected"' : ''; ?>
				<option value="2"<?php echo $selected.'>'._EASYCOMMENTS_ADMIN_EMAILCLOAKING_C; ?></option>
			<?php $selected =( $ec_config['emailcloak'] == '3' ) ? ' selected="selected"' : ''; ?>
				<option value="3"<?php echo $selected.'>'._EASYCOMMENTS_ADMIN_EMAILCLOAKING_D; ?></option>
			</select>
			<br/>
			<br/>
	<?php
} // function
function _cfg_versioncheck ( $ec_config )
{
	?>
			<strong><?php echo _EASYCOMMENTS_ADMIN_AUTOMATICVERSIONCHECK; ?></strong>
			<br/>
			<input type="radio" name="ec_config['autoversioncheck']" id="ec_autoversioncheck1" value="1" <?php if ($ec_config['autoversioncheck'] == "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_autoversioncheck1"><?php echo _EASYCOMMENTS_ADMIN_AUTOMATICVERSIONCHECK_A; ?></label>
			<br/>
			<input type="radio" name="ec_config['autoversioncheck']" id="ec_autoversioncheck0" value="0" <?php if ($ec_config['autoversioncheck'] != "1") {echo "checked='checked'";} ?> class="inputbox" />
			<label for="ec_autoversioncheck0"><?php echo _EASYCOMMENTS_ADMIN_AUTOMATICVERSIONCHECK_B; ?></label>
			<br/>
			<br/>
	<?php
} // function
function _cfg_captcha ( $ec_config )
{
				global $mosConfig_absolute_path;
				if(file_exists($mosConfig_absolute_path.'/components/com_easycaptcha/class.easycaptcha.php')){?>
				<strong><?php echo _EASYCOMMENTS_ADMIN_CAPTCHA; ?></strong>
				<br/>
				<input type="radio" name="ec_config['captcha']" id="ec_captcha1" value="1" <?php if ($ec_config['captcha'] == "1") {echo "checked='checked'";} ?> class="inputbox" />
				<label for="ec_captcha1"><?php echo _EASYCOMMENTS_ADMIN_CAPTCHA_A; ?></label>
				<br/>
				<input type="radio" name="ec_config['captcha']" id="ec_captcha0" value="0" <?php if ($ec_config['captcha'] != "1") {echo "checked='checked'";} ?> class="inputbox" />
				<label for="ec_captcha0"><?php echo _EASYCOMMENTS_ADMIN_CAPTCHA_B; ?></label>
				<br/>
				<br/>
			<?php } 
	
} // function
############################################################################

function migratorOverview() {
	global $mosConfig_live_site; ?>

<div style='background-image: url(components/com_easycomments/images/admin.settings_top.jpg); width: 899px; height: 54px; color: #7e8a91; font-size: 21px; text-align: left; margin-top: 10px;'>
	<div style="padding-left: 25px;  padding-top: 10px;">
		<?php echo _EASYCOMMENTS_ADMIN_MIGRATION; ?>
	</div>
</div>
<div style='background-image: url(components/com_easycomments/images/admin.settings_bg.jpg); width: 899px; color: #4c4e4f; font-size: 11px; text-align: left;'>
<div style="margin-left: 40px; margin-right: 40px;">
	<strong align="center"><?php echo _EASYCOMMENTS_ADMIN_MIGRATE_FROM; ?>:</strong>
	<div style='float: left; width:210px;'>
		<br />
		<a href="<?php echo $mosConfig_live_site; ?>/administrator/index2.php?option=com_easycomments&amp;task=migrate_akocomment"><img src="components/com_easycomments/images/akocomment.gif" alt="<?php echo _EASYCOMMENTS_ADMIN_MIGRATE_AKOCOMMENT; ?>" border="0" /></a>
		<br />
		<br />
	</div>
</div>
</div>
<div style='background-image: url(components/com_easycomments/images/admin.settings_bottom.jpg); background-position: bottom; width: 899px; height: 36px; font-size: 11px; color: #777777; padding-top: 40px;'>
</div>
<?php }

############################################################################

function showAbout() {
	global $mosConfig_live_site; ?>

<div style='background-image: url(components/com_easycomments/images/admin.settings_top.jpg); width: 899px; height: 54px; color: #7e8a91; font-size: 21px; text-align: left; margin-top: 10px;'>
	<div style="padding-left: 25px;  padding-top: 10px;">
		<?php echo _EASYCOMMENTS_ADMIN_INFORMATION; ?>
	</div>
</div>
<div style='background-image: url(components/com_easycomments/images/admin.settings_bg.jpg); width: 899px; color: #4c4e4f; font-size: 11px; text-align: left;'>
<div style="margin-left: 40px; margin-right: 40px; position: relative;">
		<br />
		<?php echo _EASYCOMMENTS_ADMIN_CREDITS; ?>
</div>
</div>
<div style='background-image: url(components/com_easycomments/images/admin.settings_bottom.jpg); background-position: bottom; width: 899px; height: 36px; font-size: 11px; color: #777777; padding-top: 40px;'>
</div>
<?php }

############################################################################

function showComments( $option, &$rows, &$search, &$pageNav ) {
 	global $mosConfig_lang, $mosConfig_offset; $commentlenght = "40";?>

<form action="index2.php" method="post" name="adminForm">
	<?php if (count( $rows ) != 0) { ?>
    	<table cellpadding="4" cellspacing="0" border="0" width="100%">
			<tr>
				<td width="100%">
					<img src="components/com_easycomments/images/logo.jpg">
				</td>
				<td nowrap="nowrap">
					<?php echo _EASYCOMMENTS_ADMIN_DISPLAY; ?>:
				</td>
				<td>
					<?php echo $pageNav->writeLimitBox(); ?>
				</td>
				<td>
					<?php if($search != "") { ?>
					<b>
					<?php } ?>
					<?php echo _EASYCOMMENTS_ADMIN_SEARCH; ?>:
					<?php if($search != "") { ?>
					</b>
					<?php } ?>
				</td>
				<td>
					<input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
				</td>
			</tr>
		</table>
		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
			<tr>
				<th width="2%" class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" /></th>
				<th class="title"><div align="center"><?php echo _EASYCOMMENTS_ADMIN_AUTHOR; ?></div></th>
				<th class="title"><div align="center"><?php echo _EASYCOMMENTS_ADMIN_EMAIL; ?></div></th>
				<th class="title"><div align="left"><?php echo _EASYCOMMENTS_ADMIN_COMMENT; ?></div></th>
				<th class="title"><div align="center"><?php echo _EASYCOMMENTS_ADMIN_DATE; ?></div></th>
				<th class="title"><div align="center"><?php echo _EASYCOMMENTS_ADMIN_CONTENT_ITEM; ?></div></th>
				<th class="title"><div align="center"><?php echo _EASYCOMMENTS_ADMIN_PUBLISHED; ?></div></th>
			</tr>

<?php
	$k = 0;
	for ($i=0, $n=count( $rows ); $i < $n; $i++) {
		$row = &$rows[$i];
		echo "<tr class='row$k'>";
		echo "<td width='5%'><input type='checkbox' id='cb$i' name='cid[]' value='$row->id' onclick='isChecked(this.checked);' /></td>";
		echo "<td align='center'><a href=\"index2.php?option=".$option."&task=edit&cid[]=".$row->id."\">$row->name</a></td>";

        $email = $row->email ? ('<a href="mailto:'.$row->email.'">'.$row->email.'</a>') : "&nbsp";
		echo "<td align='center'>$email</td>";


		if(strlen($row->comment) > $commentlenght) {
			$row->comment  = substr($row->comment,0,$commentlenght-3);
			$row->comment .= "...";
		}
		echo "<td align='left'>$row->comment</td>";
		if ($mosConfig_lang == "germani" || $mosConfig_lang == "germanf" || $mosConfig_lang == "german") {
			$signtime = strftime("%d. %B %Y",$row->date + ($mosConfig_offset*60*60));
		} else {
			$signtime = strftime("%m/%d/%y",$row->date + ($mosConfig_offset*60*60));
		}
		echo "<td align='center'>$signtime</td>";
		echo "<td align='center'>$row->contentid</td>";
		if(strlen($row->comment) > $commentlenght) {
        	$row->comment  = substr($row->comment,0,$commentlenght-3);
        	$row->comment .= "...";
        }
        $task = $row->published ? 'unpublish' : 'publish';
        $img = $row->published ? 'publish_g.png' : 'publish_x.png';
?>
				<td width="10%" align="center">
					<a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
						<img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="" />
					</a>
				</td>
			</tr>
<?php    $k = 1 - $k; } ?>

    		<tr>
      			<th align="center" colspan="7">
        			<?php echo $pageNav->writePagesLinks(); ?>
        		</th>
    		</tr>
    		<tr>
      			<td align="center" colspan="7">
        			<?php echo $pageNav->writePagesCounter(); ?>
        		</td>
			</tr>
		</table>

<?php } else { ?>

<table cellpadding="4" cellspacing="0" border="0" width="100%">
			<tr>
				<td width="100%">
					<img src="components/com_easycomments/images/logo.jpg">
				</td>
				<td nowrap="nowrap">
					<?php echo _EASYCOMMENTS_ADMIN_DISPLAY; ?>:
				</td>
				<td>
					<?php echo $pageNav->writeLimitBox(); ?>
				</td>
				<td>
					<?php if($search != "") { ?>
					<b>
					<?php } ?>
					<?php echo _EASYCOMMENTS_ADMIN_SEARCH; ?>:
					<?php if($search != "") { ?>
					</b>
					<?php } ?>
				</td>
				<td>
					<input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
				</td>
			</tr>
		</table>
		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
			<tr>
				<th width="2%" class="title"><?php echo _EASYCOMMENTS_ADMIN_NO_COMMENTS; ?></th>

			</tr>
		</table>

<?php } ?>

<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
<?php }

############################################################################

function editComment( $option, &$row, &$clist, &$olist, &$puplist ) {
	mosMakeHtmlSafe( $row, ENT_QUOTES, 'comment' ); ?>

<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform( pressbutton );
			return;
		}

      // do field validation
		if (form.comment.value == ""){
        	alert( "<?php echo _EASYCOMMENTS_ADMIN_WRITE_COMMENT; ?>" );
		} else if (form.contentid.value == "0"){
        	alert( "<?php echo _EASYCOMMENTS_ADMIN_SELECT_ITEM; ?>" );
		} else if (form.name.value == ""){
        	alert( "<?php echo _EASYCOMMENTS_ADMIN_ENTER_NAME; ?>" );
		} else {
        	submitform( pressbutton );
		}
	}
</script>

<table cellpadding="4" cellspacing="0" border="0" width="100%">
	<tr>
		<td width="100%">
			<span class="sectionname">
<?php echo $row->id ? 'Edit' : 'Add';?>
<?php echo _EASYCOMMENTS_ADMIN_COMMENT; ?>
			</span>
		</td>
	</tr>
</table>

<form action="index2.php" method="post" name="adminForm" id="adminForm">
	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%" align="right">
				<?php echo _EASYCOMMENTS_ADMIN_NAME; ?>:
			</td>
			<td width="80%">
				<input class="inputbox" type="text" name="name" size="50" maxlength="30" value="<?php echo $row->name;?>" />
			</td>
		</tr>
		<tr>
			<td width="20%" align="right">
				<?php echo _EASYCOMMENTS_ADMIN_EMAIL; ?>:
			</td>
			<td width="80%">
				<input class="inputbox" type="text" name="email" size="50" maxlength="100" value="<?php echo $row->email;?>" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<?php echo _EASYCOMMENTS_ADMIN_CONTENT_ITEM; ?>:
			</td>
			<td>
				<?php echo $clist; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<?php echo _EASYCOMMENTS_ADMIN_TITLE; ?>:
			</td>
			<td>
				<input class="inputbox" type="text" name="title" value="<?php echo $row->title; ?>" size="50" maxlength="50" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<?php echo _EASYCOMMENTS_ADMIN_COMMENT; ?>:
			</td>
			<td>
				<textarea class="inputbox" cols="50" rows="5" name="comment"><?php echo $row->comment;?></textarea>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<?php echo _EASYCOMMENTS_ADMIN_ORDERING; ?>:
			</td>
			<td>
				<?php echo $olist; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<?php echo _EASYCOMMENTS_ADMIN_PUBLISHED; ?>:
			</td>
			<td>
				<?php echo $puplist; ?>
			</td>
		</tr>
	</table>
	<input type="hidden" name="id" value="<?php echo $row->id; ?>" /> <input type="hidden" name="option" value="<?php echo $option;?>" /> <input type="hidden" name="task" value="" />
</form>

<?php }

###########################################################################

} ?>
